/*
 * Copyright (c) 2012 Qunar.com. All Rights Reserved
 */

package com.pyb.common.utils;

/**
 * CloneUtil
 *
 * @author chuchen.zhang
 * @date 16-9-12 下午1:34
 */
public class CloneUtil {

    /**
     * deep clone, the recursive objects will clone must implement Serializable
     */
    public static <T> T deepClone(T object) throws Exception {
        if (object == null) {
            return null;
        }
        return SerializationUtil.deserializer(
                SerializationUtil.serializer(object), (Class<T>)object.getClass()
        );
    }

}
